package com.viu.technology.dto;

import com.viu.technology.util.JsonUtil;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 由于工单系统较为复杂，此处作为演示构造一个简单的实体类
 */
public class WorkOrder {

    /**
     * 工单ID
     */
    @NotNull(message = "工单ID不能为空")
    private String orderId;
    /**
     * 提交人ID
     */
    @NotNull(message = "提交人ID不能为空")
    private String submitUserId;
    /**
     * 审核人ID
     */
    @NotNull(message = "审核人ID不能为空")
    private String auditUserId;
    /**
     * 工单详情
     */
    @NotNull(message = "工单详情不能为空")
    private Object orderDetails;
    /**
     * 工单类型
     */
    @NotNull(message = "工单类型不能为空")
    private Integer type;
    /**
     * 工单状态
     */
    @NotNull(message = "工单状态不能为空")
    private Integer status;
    /**
     * 提交日期
     */
    @NotNull(message = "提交日期不能为空")
    private Date submitDate;
    /**
     * 完成日期
     */
    private Date completeDate;


    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getSubmitUserId() {
        return submitUserId;
    }

    public void setSubmitUserId(String submitUserId) {
        this.submitUserId = submitUserId;
    }

    public String getAuditUserId() {
        return auditUserId;
    }

    public void setAuditUserId(String auditUserId) {
        this.auditUserId = auditUserId;
    }

    public Object getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(Object orderDetails) {
        this.orderDetails = orderDetails;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getSubmitDate() {
        return submitDate;
    }

    public void setSubmitDate(Date submitDate) {
        this.submitDate = submitDate;
    }

    public Date getCompleteDate() {
        return completeDate;
    }

    public void setCompleteDate(Date completeDate) {
        this.completeDate = completeDate;
    }

    @Override
    public String toString() {
        JsonUtil jsonUtil = new JsonUtil();
        return jsonUtil.objectToJsonObject(this).toString();
    }

    public WorkOrder(String orderId,String submitUserId,String auditUserId,Object orderDetails) {
        this.orderId = orderId;
        this.submitUserId = submitUserId;
        this.auditUserId = auditUserId;
        this.orderDetails = orderDetails;
        this.type = 1;
        this.status = 1;
        this.submitDate = new Date();
    }

    public static void main(String args[]){
        WorkOrder order = new WorkOrder("1231", "123123", "123132123", "这个是工单");
        System.out.println(order.toString());

    }
}
